<?php

namespace Common\Model;

use Think\Model;

class WorksModel extends Model
{
	//定义前缀	作品主表
    protected $tablePrefix = 'blog_';
	
	/**
	 * 获取当前作品信息
	 * 作品id	$worksid
	 */
	 public function query_blog_works_bay($worksid){
	 	if(empty($worksid) ||  intval($worksid) < 0){
	 		return false;
	 	}
		$where=array(
			'id' => $worksid,
			'works_ischeck' => array('neq',3),//审核状态:1.待审核；2.审核成功；3.审核失败
			'is_delete' => 1,//是否删除:1.正常；2.删除
		);
	 	$list=$this->where($where)->find();
		// dump($this->getlastsql($list));
		if(empty($list)){
			return false;
		}
		
		return  $list;
	 }
	 
	 /**
	  * 查看用户一条作品信息
	  * 用户id	$works_memberid
	  * 作品id   $worksid
	  */
	  public function see_blog_works_bay($works_memberid,$worksid){
	 	if(empty($worksid) ||  empty($works_memberid)){
	 		return false;
	 	}
	 	$list=$this->where(array('id'=>$worksid,'works_memberid'=>$works_memberid))->find();
		// dump($this->getlastsql($list));
		if(empty($list)){
			return false;
		}
		
		return  $list;		
		
			  	
	  }
	 
	 
	 
	 
	 

}